home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9398 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: peachy.apana.org.au!grahamb
  2. From: grahamb@peachy.apana.org.au (Graham Broadbridge)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Leap Years
  5. Date: 11 Mar 1996 09:39:48 GMT
  6. Organization: The Peachy Linux Node!
  7. Message-ID: <4i0sd4$7lr@peachy.apana.org.au>
  8. References: <8BA8405.02C70020E1.uuout@sourcebbs.com> <4h6ara$mu@netnews1.apci.com> <825684095snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: peachy.apana.org.au
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Lawrence Kirby (fred@genesis.demon.co.uk) wrote:
  13. : In article <4h6ara$mu@netnews1.apci.com> wardmw@apci.com "Martin Ward" writes:
  14.  
  15. : >david.mohorn@sourcebbs.com (DAVID MOHORN) typed:
  16. : >
  17. : >>How do you feature out leap years?  If its evenly divisible by 400 and
  18. : >>4?
  19.  
  20. I can't believe that anyone here can get confused about this.
  21.  
  22. isleap(int year)
  23. {
  24. if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
  25.     printf("%d is a leap year", year);
  26. else
  27.     printf("%d is not a leap year", year);
  28. }
  29.  
  30. --
  31. +----------------------------------------------------------------------------+
  32.   Graham Broadbridge        Internet <grahamb@peachy.apana.org.au>
  33.   Marsfield   NSW                    <vk2yui@amsat.org>
  34.   Australia                 amprnet  <vk2yui@gw.vk2yui.ampr.org>
  35. +----------------------------------------------------------------------------+
  36.